<?php
    $code = $_GET["code"];
    //echo "Code = ".$code."<br/>";
    
    $uri = "http://yourstyle.name/raovat/signupFb.php";
	//echo $uri; exit;
    $uri = urlencode($uri);
    
    $token_url = "https://graph.facebook.com/oauth/access_token?client_id=618836824809238&client_secret=25e84a57bdd0b1c8ac5cca91e608c123&code=".$code."&redirect_uri=".$uri;
	$response = @file_get_contents($token_url);
	var_dump($response); exit;
	$params = null;
 
	parse_str($response, $params);
	
	
	$graph_url = "https://graph.facebook.com/me?access_token=".$params['access_token'];
 
	$user = json_decode(file_get_contents($graph_url));

	$username = $user->username;
	$email = $user->email;
	$facebook_id = $user->id;
	setcookie("username", $username, time()+ 3600);
	echo "<script>window.close();  window.opener.location.reload();</script>";




?>